﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Basmus.DataStructures.Generic
{
	public class Group<TKey, TElement> : IGrouping<TKey, TElement>
	{
		private TKey _key;
		private IEnumerable<TElement> _elements;
		#region IGrouping<TKey,TElement> Members

		public TKey Key
		{
			get { return _key; }
		}

		#endregion

		#region IEnumerable<TElement> Members

		public IEnumerator<TElement> GetEnumerator()
		{
			return _elements.GetEnumerator();
		}

		#endregion

		#region IEnumerable Members

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			return _elements.GetEnumerator();
		}

		#endregion
		public Group(TKey key, IEnumerable<TElement> elements)
		{
			_key = key;
			_elements = elements;
		}
	}
}
